package com.action;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.ServletActionContext;

import com.dao.CommonDAO;
import com.dao.SysuserDAO;
import com.model.Menuinfo;
import com.model.Notice;
import com.model.Sysuser;
import com.opensymphony.xwork2.ActionSupport;
import com.util.Info;
import com.util.Pagination;

public class menuAction extends ActionSupport
{
	private Integer id;
    private String menuname;
    private String url;
    private String seq;
	private int index=1;
	String no;
	String suc;
	private String utype;
	private CommonDAO commonDAO;
	
	
	
	public String getSeq() {
		return seq;
	}

	public void setSeq(String seq) {
		this.seq = seq;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getMenuname() {
		return menuname;
	}

	public void setMenuname(String menuname) {
		this.menuname = menuname;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}

	public String getNo() {
		return no;
	}

	public void setNo(String no) {
		this.no = no;
	}

	public String getSuc() {
		return suc;
	}

	public void setSuc(String suc) {
		this.suc = suc;
	}

	public String getUtype() {
		return utype;
	}

	public void setUtype(String utype) {
		this.utype = utype;
	}

	public CommonDAO getCommonDAO() {
		return commonDAO;
	}

	public void setCommonDAO(CommonDAO commonDAO) {
		this.commonDAO = commonDAO;
	}

	//添加功能
	public String menuAdd(){
			Menuinfo mi = new Menuinfo();
			mi.setMenuname(menuname);
			mi.setUrl(url);
			mi.setSeq(seq);
		    commonDAO.save(mi);
		    suc="";
			return "success";
	}
	
	//编辑功能
	public String menuEdit(){
		Menuinfo mi = (Menuinfo)commonDAO.findById(id, "Menuinfo");
		mi.setMenuname(menuname);
		mi.setUrl(url);
		mi.setSeq(seq);
		commonDAO.update(mi);
		suc="";
		return "success";
	}
	
}
